package com.hq.door.service.impl;

import java.util.List;

import com.hq.door.dao.IBaseDao;
import com.hq.door.dao.impl.BaseDaoImpl;
import com.hq.door.service.IBaseService;

public class BaseServiceImpl<T> implements IBaseService<T> {
	//需要依赖baseDao实现基础数据库操作
	private IBaseDao<T> baseDao;
	
	
	public IBaseDao<T> getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(IBaseDao<T> baseDao) {
		this.baseDao = baseDao;
	}

	@Override
	public void save(T entity){
		baseDao.save(entity);
	}

	@Override
	public void update(T entity) {
		baseDao.update(entity);
	}

	@Override
	public void delete(T entity) {
		baseDao.delete(entity);
	}

	@Override
	public void saveOrUpdate(T entity) {
		baseDao.saveOrUpdate(entity);
	}

	@Override
	public T get(int id) {
		return baseDao.get(id);
	}

	@Override
	public <T> List<T> findPageObjects(String hql, int pageStart, int pageSize,
			Object... conditions) {
		return baseDao.findPageObjects(hql, pageStart, pageSize, conditions);
	}

	@Override
	public List<T> find(String hql, Object[] values) {
		// TODO Auto-generated method stub
		return baseDao.find(hql, values);
	}
	
	
}
